package com.generic.potential.type.demo2;

import java.util.Collection;

import com.generic.genericinterface.demo1.Generator;

public class Fill {

	public static <T> void fill(Addable<T> addable,
			Class<? extends T> classToken, int size) {
		for (int i = 0; i < size; i++) {
			try {
				addable.add(classToken.newInstance());
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	public static <T> void fill(Addable<T> addable, Generator<T> generator,
			int size) {
		for (int i = 0; i < size; i++) {
			try {
				addable.add(generator.next());
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

}
